# -*- coding: utf-8 -*-
from app.configs import global_config, root_path, sys_type
from tornado.web import StaticFileHandler

from app.views.views_init import InitHandler
from app.views.views_dump import DumpHandler
from app.views.views_vector import VectorsHandler
from app.views.views_dxf import DxfHandler
from app.views.views_dwg import DwgHandler
from app.views.views_mine import MineHandler
from app.views.views_track import TrackHandler
from app.views.views_position import PositionHandler
from app.views.views_person import PersonHandler
from app.views.views_vehicle import VehicleHandler
from app.views.views_code import CodeHandler, ConfigHandler
from app.views.views_meta import MetaHandler
from app.views.views_metas import MetasHandler
from app.views.views_warning import WarningHandler
from app.views.views_monitor import MonitorHandler
from app.views.views_reader import ReaderHandler
from app.views.views_car import CarHandler, CarTrackHandler
from app.views.views_sensor import SensorHandler

from app.views.views_sm_manager import SensorAdminDataHandler, SensorDataHandler, SmInfoHandler, SmPositionInit, SmPositionHandler

from app.views.views_gas_integration import IntergenerationalHandler
from app.views.views_ventilation import VentilationHandler, VentilationRotationHandler

# 沈阳院 用到的树结构数据接口的handler
from app.views.views_shanxi_handle import TreeDataHandler, ShanxiDeviceHandler, StaffDataHandler, KstationDataHandler, KnodeDataHandler, VcameraDataHandler, StaffTrackHandler, MetaVersion2TopHandler

# 静态变量地址
static_path = root_path + '\\static' if sys_type == 'Windows' else root_path + '/static'


# 路由视图映射：(路由地址,视图)
urls = [
    (r'/init', InitHandler),
    (r'/meta', MetaHandler),
    (r'/metas', MetasHandler),
    (r'/dump', DumpHandler),
    (r'/code', CodeHandler),
    (r'/config', ConfigHandler),
    (r'/vector', VectorsHandler),
    (r'/dxf', DxfHandler),
    (r'/dwg', DwgHandler),
    (r'/mine', MineHandler),
    (r'/track', TrackHandler),
    (r'/position', PositionHandler),
    # (r'/vehicle', VehicleHandler),
    # (r'/person', PersonHandler),
    (r'/warning', WarningHandler),
    (r'/monitor', MonitorHandler),
    (r'/sensor', SensorHandler),
    (r'/reader', ReaderHandler),
    (r'/car', CarHandler),
    (r'/cartrack', CarTrackHandler),
    (r'/sensor_init', SmPositionInit),
    (r'/settedSmAdmin', SensorAdminDataHandler),
    (r'/settedSmData', SensorDataHandler),
    (r'/sm_position', SmPositionHandler),
    (r'/sm_info', SmInfoHandler),
    (r'/integration', IntergenerationalHandler),
    (r'/ventilation', VentilationHandler),
    (r'/ventilation_rotation', VentilationRotationHandler),
    # 沈阳院 这边的接口用到的handler
    (r'/tree_data', TreeDataHandler),
    (r'/shanxi_device_pos', ShanxiDeviceHandler),
    (r'/shanxi_staff', StaffDataHandler),
    (r'/shanxi_kstation', KstationDataHandler),
    (r'/shanxi_knode', KnodeDataHandler),
    (r'/shanxi_vcamera', VcameraDataHandler),
    (r'/shanxi_staff_track', StaffTrackHandler),
    (r'/shanxi_meta_version_manage', MetaVersion2TopHandler),
    (r'/(.*)$', StaticFileHandler, {
        'path': static_path,
        'default_filename': '''%s.html''' % global_config['name']
    })
]
